import { createApp } from 'vue'
import App from './App.vue'
//引用axios进行全局注册
import axios from './service/api'
//全局引用element ui 
import ElementPlus from 'element-plus'
import 'element-plus/lib/theme-chalk/index.css'
//引入路由
import router from './routers/index.js'


router.beforeEach((to, form, next) => {
    /* 路由改变修改页面的title */
    console.log(to)
    console.log(form)
    if (to.meta.title) {
        document.title = to.meta.title
    }    
    next()
})


const app = createApp(App)
//全局配置axios
app .config.globalProperties.$axios = axios  
//注册element ui
app.use(ElementPlus, { size: 'small', zIndex: 3000 })
app.use(router)
app.mount('#app')